Forms are where users touch your data. Pytigon's Forms Editor lets you design form layouts visually, generating either FastForm definitions or full .ihtml templates depending on the complexity you need.
For simple CRUD forms, Pytigon offers FastForm — a string-based form definition language. Instead of writing Django form classes, you describe your form as a readable text format:
What is this?
Name
Second name::*
name//Title!::*
Description::_
Date::####.##.##
Quantity::0
Choose::[option1;option2
option3]
Age::000
Each line becomes a Django form field:
| Line Pattern | Field Type | Example |
|---|---|---|
| Plain text | CharField |
Name |
::* suffix |
Required CharField |
Second name::* |
name//title |
Custom field name | name//Title!::* |
::_ suffix |
TextField |
Description::_ |
####.##.## |
DateField |
Date::####.##.## |
0 (single digit) |
IntegerField |
Quantity::0 |
9.99 |
FloatField |
Amount!::9.99 |
[options] |
ChoiceField |
Choose::[a;b;c] |
000 (multi-digit) |
IntegerField with limit |
Age::000 |
**** |
Masked CharField |
Code::**** |
Rules for automatic field name generation (when // is not used):
- Convert label to lowercase
- Remove spaces and non-alphanumeric characters
- Truncate to 16 characters
When FastForm isn't enough, you design the form directly as an .ihtml template. This gives you:
The Forms Editor lets you arrange fields using these layout building blocks:
Renders all form fields sequentially in a single column:
[row]
Chain select fields where each choice depends on the previous selection:
[comboselect "country" label="Country" data_rel_name="city" src=""]
[[[comboselect "city" label="City" src="/api/cities?country=[[country]]"]]]
The field_name syntax in the src URL is dynamically replaced with the current value of the referenced field.
div class=card
div class=card-header...Personal Information
div class=card-body
[field "first_name"]
[field "last_name"]
[field "birth_date"]
Define submit buttons and their behavior:
Forms defined in the Forms Editor integrate with the model layer through:
get_form_source() — Model method returning FastForm string definitionget_form_class() — Model method returning a dynamically generated Django Form classis_form_valid() — Static model method for custom validationpost_form() — Model method hook called after form submissionThis allows per-record form customization — different records of the same type can use different form configurations based on their state or type.